package cn.iocoder.yudao.module.dine.framework;

import cn.iocoder.yudao.framework.datapermission.v1.UniDataPermissionRuleCustomizer;
import cn.iocoder.yudao.module.dine.category.pojo.po.DineCategory;
import cn.iocoder.yudao.module.dine.desk.pojo.po.Desk;
import cn.iocoder.yudao.module.dine.desk.pojo.po.DeskCategory;
import cn.iocoder.yudao.module.dine.product.pojo.po.DineProduct;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * permission 组件的配置类
 */
@Configuration(proxyBeanMethods = false, value = "dinePermissionConfiguration")
public class DineDataPermissionConfiguration {

    @Bean
    public UniDataPermissionRuleCustomizer dineDataPermissionRuleCustomizer() {
        return rule -> {
            rule.addDataColumn(DeskCategory.class, "shop_id"); // WHERE shop_id = ?
            rule.addDataColumn(Desk.class, "shop_id"); // WHERE shop_id = ?
            rule.addDataColumn(DineCategory.class, "shop_id");
            rule.addDataColumn(DineProduct.class, "shop_id");
        };
    }

}
